package com.sumu.utils;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.sumu.baidunuomi.BaseApplication;



public class VolleyHelper {
	private static VolleyHelper volleyHelper;
	private RequestQueue queue;
	private ImageLoader imageLoader;
	private VolleyHelper(){
		queue = getRequestQueue();
		imageLoader = new ImageLoader(queue, AppImageCache.getInstance());
	}
	public static VolleyHelper getIntstance(){
		if(volleyHelper == null){
			return volleyHelper = new VolleyHelper();
		}else{
			return volleyHelper;
		}
	}
	public RequestQueue getRequestQueue(){
		if(queue == null){
			queue = Volley.newRequestQueue(BaseApplication.getApplication());

		}
		return queue;
	}
	public <T> void addRequest(Request<T> request){
		getRequestQueue().add(request);
	}
	public ImageLoader getImageLoader(){
		return imageLoader;
	}
}
